home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / akce / mediamonkey / MediaMonkey_2.5.5.999.exe / {app} / Scripts / AutoIncTrackN.vbs next >
Encoding:
Text File  |  2005-06-21  |  2.0 KB  |  70 lines

  1. ' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  2. ' This file can be replaced  in one of the future versions,
  3. ' so please if you want to modify it, make  a copy, do your
  4. ' modifications  in that copy and  change Scripts.ini  file 
  5. ' appropriately. 
  6. ' If you do not do this, you will lose  all your changes in
  7. ' this script when you install a new version of MediaMonkey
  8. ' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  9.  
  10. ' This script fills in track #s incrementally
  11.  
  12. Sub AutoIncTrackNumbers
  13.   ' Define variables
  14.   Dim list, itm, i, tmp
  15.  
  16.   ' Get list of selected tracks from MediaMonkey
  17.   Set list = SDB.CurrentSongList 
  18.   If list.Count=0 Then
  19.     Exit Sub
  20.   End If
  21.  
  22.   Set UI = SDB.UI
  23.  
  24.   ' Create the window to be shown
  25.   Set Form = UI.NewForm
  26.   Form.Common.SetRect 0, 0, 400, 180
  27.   Form.FormPosition = 4   ' Screen Center
  28.   Form.BorderStyle = 3    ' Dialog
  29.   Form.Caption = SDB.Localize("Auto-increment Track #s")         ' TODO:  Localize
  30.  
  31.   Set Lbl = UI.NewLabel( Form)
  32.   Lbl.Common.SetRect 10,15,280,20
  33.   Lbl.Caption = SDB.LocalizedFormat( "Are you sure you want to modify the %d selected track(s)?", list.Count, 0, 0)     ' TODO:  Localize
  34.  
  35.   Set Lbl = UI.NewLabel( Form)
  36.   Lbl.Common.SetRect 10,50,280,20
  37.   Lbl.Caption = SDB.Localize("Start numbering from:")     ' TODO:  Localize
  38.  
  39.   Set SE = UI.NewSpinEdit( Form)
  40.   SE.Common.SetRect Lbl.Common.Left+Lbl.Common.Width+10, 46, 50, 20
  41.   SE.MinValue = 1
  42.   SE.MaxValue = 9999
  43.   SE.Value = 1
  44.  
  45.   Set Btn = UI.NewButton( Form)
  46.   Btn.Caption = SDB.Localize("&Ok")
  47.   Btn.Common.SetRect 115,100,75,25
  48.   Btn.ModalResult = 1
  49.   Btn.Default = true
  50.  
  51.   Set Btn = UI.NewButton( Form)
  52.   Btn.Caption = SDB.Localize("&Cancel")
  53.   Btn.Common.SetRect 220,100,75,25
  54.   Btn.ModalResult = 2
  55.   Btn.Cancel = true
  56.   
  57.   if Form.ShowModal=1 then
  58.     number = SE.Value
  59.     ' Process all selected tracks
  60.     For i=0 To list.count-1
  61.       Set itm = list.Item(i)
  62.  
  63.       ' Swap the fields
  64.       itm.TrackOrder = number
  65.       number = number + 1
  66.     Next
  67.     list.UpdateAll
  68.   End If
  69. End Sub
  70.